/*
 * UpdateMatricesCir051.java
 *
 * Created on 8 de agosto de 2008, 11:43 AM
 */
package ig.metrica.ui.matrizcorrelacion;

import ejb.metrica.matriz.correlacion.MatrizCorrelacionSBBean;
import ig.metrica.ui.PrincipalMetrica;
import ig.util.AlignmentRender;
import ig.util.CodigoBotones;
import ig.util.ConexionServer;
import ig.util.GenScripMatricesCir051;
import ig.util.GenVectorMatricesCir051;
import ig.util.TModelUpdateCircular051;
import ig.util.ejb.IGBean;
import java.awt.Component;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Properties;
import javax.naming.Context;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author  jsanchez
 */
public class UpdateMatricesCir051 extends javax.swing.JInternalFrame {

    /** Creates new form UpdateMatricesCir051 */
    public UpdateMatricesCir051(JFrame frame) {
        initComponents();
        TVolatilidades.setDefaultRenderer(String.class, new AlignmentRender());
        TMatrizChoqueME.setDefaultRenderer(String.class, new AlignmentRender());
        TMatrizChoqueUVR.setDefaultRenderer(String.class, new AlignmentRender());
        TMatrizChoqueCOP.setDefaultRenderer(String.class, new AlignmentRender());
        TMatrizCorrelacion.setDefaultRenderer(String.class, new AlignmentRender());

//        new LoadHojaDeCalculo(new File("/home/Entrada/CIRCULAR 051/matricesreporjul2008.xls")).start();

        this.setVisible(true);
    }

    public Component getPanel() {
        return this;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        CMatriz = new javax.swing.JCheckBox();
        CVolatilidades = new javax.swing.JCheckBox();
        CChoques = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        TFile = new javax.swing.JTextField();
        BBuscar = new javax.swing.JButton();
        progreso = new javax.swing.JProgressBar();
        jLabel10 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        TVolatilidades = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        TMatrizCorrelacion = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jPanel10 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        TMatrizChoqueCOP = new javax.swing.JTable();
        jLabel15 = new javax.swing.JLabel();
        TMatrizChoqueUVR = new javax.swing.JTable();
        TMatrizChoqueME = new javax.swing.JTable();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        BAlmacenar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);

        jPanel1.setBackground(new java.awt.Color(254, 254, 254));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/ooo-calc.png"))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/db2.png"))); // NOI18N

        jLabel3.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jLabel3.text")); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
        );

        jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane1MouseClicked(evt);
            }
        });

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        CMatriz.setSelected(true);
        CMatriz.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.1.text")); // NOI18N
        CMatriz.setName("1"); // NOI18N

        CVolatilidades.setSelected(true);
        CVolatilidades.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.2.text")); // NOI18N
        CVolatilidades.setName("2"); // NOI18N

        CChoques.setSelected(true);
        CChoques.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.3.text")); // NOI18N
        CChoques.setName("3"); // NOI18N

        jLabel4.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jLabel4.text")); // NOI18N
        jLabel4.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);

        TFile.setToolTipText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.TFile.toolTipText")); // NOI18N
        TFile.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                TFileKeyReleased(evt);
            }
        });

        BBuscar.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.BBuscar.text")); // NOI18N
        BBuscar.setToolTipText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.BBuscar.toolTipText")); // NOI18N
        BBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BBuscarActionPerformed(evt);
            }
        });

        jLabel10.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jLabel10.text")); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CVolatilidades)
                            .addComponent(CChoques)
                            .addComponent(CMatriz)))
                    .addComponent(progreso, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addComponent(TFile, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CMatriz)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CVolatilidades)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CChoques)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TFile, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 235, Short.MAX_VALUE)
                .addComponent(progreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));

        TVolatilidades.setBackground(new java.awt.Color(254, 254, 254));
        TVolatilidades.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        TVolatilidades.setModel(
            new TModelUpdateCircular051(null, new String [] {"."}, new boolean [] {false})

            /*new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null},
                    {""},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null},
                    {null}
                },
                new String [] {
                    "."
                })*/
            );

            jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/volatilidades.png"))); // NOI18N

            jLabel6.setBackground(new java.awt.Color(254, 254, 254));
            jLabel6.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
            jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/volatilidades2.png"))); // NOI18N
            jLabel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3));
            jLabel6.setOpaque(true);

            javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
            jPanel2.setLayout(jPanel2Layout);
            jPanel2Layout.setHorizontalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel5)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(TVolatilidades, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
                        .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE))
                    .addContainerGap())
            );
            jPanel2Layout.setVerticalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(TVolatilidades, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addComponent(jLabel5))
                    .addContainerGap(34, Short.MAX_VALUE))
            );

            jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

            jScrollPane1.setBorder(null);
            jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            jScrollPane1.setMaximumSize(new java.awt.Dimension(2767, 2767));

            jPanel6.setBackground(new java.awt.Color(255, 255, 255));
            jPanel6.setPreferredSize(new java.awt.Dimension(1530, 908));

            jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/Matriz.png"))); // NOI18N

            jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/Matriz2.png"))); // NOI18N

            jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/Matriz3.png"))); // NOI18N

            TMatrizCorrelacion.setBackground(new java.awt.Color(254, 254, 254));
            TMatrizCorrelacion.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
            TMatrizCorrelacion.setFont(new java.awt.Font("DejaVu Sans", 0, 10)); // NOI18N
            TMatrizCorrelacion.setModel(

                new TModelUpdateCircular051(null,
                    new String [] {".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "."},
                    new boolean [] {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false})
                /*new javax.swing.table.DefaultTableModel(
                    new Object [][] {
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}
                    },
                    new String [] {
                        "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7", "Title 8", "Title 9", "Title 10", "Title 11", "Title 12", "Title 13", "Title 14", "Title 15", "Title 16", "Title 17", "Title 18"
                    })*/
                );

                javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
                jPanel6.setLayout(jPanel6Layout);
                jPanel6Layout.setHorizontalGroup(
                    jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 1298, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)
                            .addComponent(TMatrizCorrelacion, javax.swing.GroupLayout.PREFERRED_SIZE, 1290, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                );
                jPanel6Layout.setVerticalGroup(
                    jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel6Layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(TMatrizCorrelacion, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addContainerGap(483, Short.MAX_VALUE))
                );

                jScrollPane1.setViewportView(jPanel6);

                javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
                jPanel3.setLayout(jPanel3Layout);
                jPanel3Layout.setHorizontalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGap(0, 614, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE))
                );
                jPanel3Layout.setVerticalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGap(0, 450, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE))
                );

                jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N

                jPanel4.setBackground(new java.awt.Color(255, 255, 255));

                jScrollPane2.setBorder(null);
                jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

                jPanel10.setBackground(new java.awt.Color(255, 255, 255));
                jPanel10.setPreferredSize(new java.awt.Dimension(1120, 493));

                jPanel9.setBackground(new java.awt.Color(255, 255, 255));

                jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC.png"))); // NOI18N

                jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC1.png"))); // NOI18N

                jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC2.png"))); // NOI18N

                javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
                jPanel9.setLayout(jPanel9Layout);
                jPanel9Layout.setHorizontalGroup(
                    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                );
                jPanel9Layout.setVerticalGroup(
                    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addGap(35, 35, 35)
                        .addComponent(jLabel12)
                        .addGap(28, 28, 28)
                        .addComponent(jLabel13)
                        .addContainerGap(60, Short.MAX_VALUE))
                );

                jPanel8.setBackground(new java.awt.Color(255, 255, 255));

                jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC3.png"))); // NOI18N

                TMatrizChoqueCOP.setBackground(new java.awt.Color(254, 254, 254));
                TMatrizChoqueCOP.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
                TMatrizChoqueCOP.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
                TMatrizChoqueCOP.setModel(

                    new TModelUpdateCircular051(null,
                        new String [] {".", ".", ".", ".", ".", ".", ".", ".", "."},
                        new boolean [] {false, false, false, false, false, false, false, false, false}
                    )
                    /*new javax.swing.table.DefaultTableModel(
                        new Object [][] {
                            {null, null, null, null, null, null, null, null, null},
                            {null, null, null, null, null, null, null, null, null},
                            {null, null, null, null, null, null, null, null, null}
                        },
                        new String [] {
                            "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7", "Title 8", "Title 9"
                        })*/
                    );

                    jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
                    jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC4.png"))); // NOI18N

                    TMatrizChoqueUVR.setBackground(new java.awt.Color(254, 254, 254));
                    TMatrizChoqueUVR.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
                    TMatrizChoqueUVR.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
                    TMatrizChoqueUVR.setModel(
                        new TModelUpdateCircular051(null,
                            new String [] {".", ".", ".", ".", ".", ".", ".", ".", "."},
                            new boolean [] {false, false, false, false, false, false, false, false, false}
                        )
                        /*new javax.swing.table.DefaultTableModel(
                            new Object [][] {
                                {null, null, null, null, null, null, null, null, null},
                                {null, null, null, null, null, null, null, null, null},
                                {null, null, null, null, null, null, null, null, null}
                            },
                            new String [] {
                                "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7", "Title 8", "Title 9"
                            })*/
                        );

                        TMatrizChoqueME.setBackground(new java.awt.Color(254, 254, 254));
                        TMatrizChoqueME.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
                        TMatrizChoqueME.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
                        TMatrizChoqueME.setModel(
                            new TModelUpdateCircular051(null,
                                new String [] {".", ".", ".", ".", ".", ".", ".", ".", "."},
                                new boolean [] {false, false, false, false, false, false, false, false, false}
                            )

                            /*new javax.swing.table.DefaultTableModel(
                                new Object [][] {
                                    {null, null, null, null, null, null, null, null, null},
                                    {null, null, null, null, null, null, null, null, null},
                                    {null, null, null, null, null, null, null, null, null}
                                },
                                new String [] {
                                    "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7", "Title 8", "Title 9"
                                })*/
                            );

                            jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC3.png"))); // NOI18N

                            jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
                            jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC4.png"))); // NOI18N

                            jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC3.png"))); // NOI18N

                            jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
                            jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/util/images/MatriC4.png"))); // NOI18N

                            javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
                            jPanel8.setLayout(jPanel8Layout);
                            jPanel8Layout.setHorizontalGroup(
                                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 918, Short.MAX_VALUE)
                                .addGroup(jPanel8Layout.createSequentialGroup()
                                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 908, Short.MAX_VALUE)
                                        .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, 908, Short.MAX_VALUE)
                                        .addGroup(jPanel8Layout.createSequentialGroup()
                                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(TMatrizChoqueCOP, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(TMatrizChoqueUVR, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(TMatrizChoqueME, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                            .addGap(0, 0, Short.MAX_VALUE)))
                                    .addContainerGap())
                            );
                            jPanel8Layout.setVerticalGroup(
                                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel8Layout.createSequentialGroup()
                                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(TMatrizChoqueCOP, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel15)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel16)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(TMatrizChoqueUVR, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(TMatrizChoqueME, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel19)
                                    .addGap(36, 36, 36))
                            );

                            javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
                            jPanel10.setLayout(jPanel10Layout);
                            jPanel10Layout.setHorizontalGroup(
                                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            );
                            jPanel10Layout.setVerticalGroup(
                                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addContainerGap(126, Short.MAX_VALUE))
                            );

                            jScrollPane2.setViewportView(jPanel10);

                            javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
                            jPanel4.setLayout(jPanel4Layout);
                            jPanel4Layout.setHorizontalGroup(
                                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 594, Short.MAX_VALUE)
                                    .addContainerGap())
                            );
                            jPanel4Layout.setVerticalGroup(
                                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)
                                    .addContainerGap())
                            );

                            jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

                            BAlmacenar.setText(org.openide.util.NbBundle.getMessage(UpdateMatricesCir051.class, "UpdateMatricesCir051.BAlmacenar.text")); // NOI18N
                            BAlmacenar.setEnabled(false);
                            BAlmacenar.addActionListener(new java.awt.event.ActionListener() {
                                public void actionPerformed(java.awt.event.ActionEvent evt) {
                                    BAlmacenarActionPerformed(evt);
                                }
                            });

                            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                            getContentPane().setLayout(layout);
                            layout.setHorizontalGroup(
                                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(BAlmacenar, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap())
                                .addComponent(jTabbedPane1)
                            );
                            layout.setVerticalGroup(
                                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jTabbedPane1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(BAlmacenar)
                                    .addContainerGap())
                            );

                            pack();
                        }// </editor-fold>//GEN-END:initComponents
    private String path = null;

    private void buscar(boolean FChooser) {
        JFileChooser chooser = null;
        if (FChooser) {
            progreso.setIndeterminate(true);
            if (path != null) {
                chooser = new JFileChooser(path);
            } else {
                chooser = new JFileChooser();
            }
            if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
                this.path = chooser.getSelectedFile().getAbsolutePath();
                progreso.setIndeterminate(false);
                new LoadHojaDeCalculo(chooser.getSelectedFile()).start();
            } else {
                progreso.setIndeterminate(false);
                progreso.setValue(0);
            }
        } else {
            if(new File(this.TFile.getText()).exists()){
                new LoadHojaDeCalculo(new File(this.TFile.getText())).start();
            }else if(!this.TFile.getText().trim().equals("")){                
                JOptionPane.showMessageDialog(this, "La Hoja de calculo seleccionada no existe\n["+this.TFile.getText()+"]");
            }
        }
    }
private void BBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BBuscarActionPerformed
    this.buscar(true);
}//GEN-LAST:event_BBuscarActionPerformed

private void BAlmacenarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BAlmacenarActionPerformed

    if(!PrincipalMetrica.validarPermisos(this.getTitle(), PrincipalMetrica.GUARDAR)){
        JOptionPane.showMessageDialog(this, "Usted no tiene permisos para guardar informaci\u00F3n sobre esta opci\u00F3n");
        return;
    }

    try {
        if (cScript != null) {
            int sum = 0;
            for (Integer index : c) {
                sum += index;
            }
            if (sum != 6) {
                JOptionPane.showMessageDialog(this, "La matriz fue cargada satisfactoriamente, pero\nNO ha validado los datos que se cargaron");
            } else {
                this.lookupMatrizCorrelacionSBBean().updateFormScript(cScript);
                JOptionPane.showMessageDialog(this,
                        "Los datos relacionados con la Circular 051 de 2008 \n fueron actualizados satisfactoriamente.");
            }
        } else {
            JOptionPane.showMessageDialog(this, "Cargue primero la matriz: \n");
        }
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(this, "Error al intentar almacenar la matriz: \n" + ex);
    }
}//GEN-LAST:event_BAlmacenarActionPerformed
    private Collection<Integer> c = new ArrayList();
private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked
// TODO add your handling code here:
    int index = jTabbedPane1.getSelectedIndex();
    if (!c.contains(index)) {
        c.add(index);
    }
}//GEN-LAST:event_jTabbedPane1MouseClicked

private void TFileKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TFileKeyReleased
// TODO add your handling code here:
    //System.out.println(evt.getKeyCode());
    if (evt.getKeyCode() == 10) {
        this.buscar(false);
    }

}//GEN-LAST:event_TFileKeyReleased

    int coun=0;
    private ejb.metrica.matriz.correlacion.MatrizCorrelacionSBBean lookupMatrizCorrelacionSBBean() {
        
        return new MatrizCorrelacionSBBean();
        
        /*try {
            Properties prop = new Properties();
            prop.put(Context.INITIAL_CONTEXT_FACTORY, IGBean.INITIAL_CONTEXT_FACTORY);
            String Sockec = new ConexionServer().getSocketServer();
            prop.put(Context.PROVIDER_URL, Sockec);
                
            javax.naming.Context c = new javax.naming.InitialContext(prop);
            Object remote = c.lookup("MatrizCorrelacionSBBean");
            ejb.metrica.matriz.correlacion.MatrizCorrelacionSBRemoteHome rv = (ejb.metrica.matriz.correlacion.MatrizCorrelacionSBRemoteHome) javax.rmi.PortableRemoteObject.narrow(remote, ejb.metrica.matriz.correlacion.MatrizCorrelacionSBRemoteHome.class);
            return rv.create();
        } catch (javax.naming.NamingException ne) {
            throw new RuntimeException(ne);
        } catch (javax.ejb.CreateException ce) {
            throw new RuntimeException(ce);
        } catch (java.rmi.RemoteException re) {
            throw new RuntimeException(re);
        }*/
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BAlmacenar;
    private javax.swing.JButton BBuscar;
    private javax.swing.JCheckBox CChoques;
    private javax.swing.JCheckBox CMatriz;
    private javax.swing.JCheckBox CVolatilidades;
    private javax.swing.JTextField TFile;
    private javax.swing.JTable TMatrizChoqueCOP;
    private javax.swing.JTable TMatrizChoqueME;
    private javax.swing.JTable TMatrizChoqueUVR;
    private javax.swing.JTable TMatrizCorrelacion;
    private javax.swing.JTable TVolatilidades;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JProgressBar progreso;
    // End of variables declaration//GEN-END:variables
    private Collection<String> cScript=null;
    class LoadHojaDeCalculo extends Thread {
 
        private File xls = null;

        public LoadHojaDeCalculo(File xls) {
            this.xls = xls;
        }

        @Override
        public void run() {
            try {
                c.clear();
                super.run();
                if(cScript!=null)
                    cScript.clear();
                cScript=null;
                TFile.setText(xls.getAbsolutePath());
                progreso.setValue(20);
                /**
                 * 2=MATRIZ_CORRELACION
                 * 4=VOLATILIDADES
                 * 8=CHOQUES
                 * 6=MATRIZ_CORRELACION+VOLATILIDADES
                 * 10=MATRIZ_CORRELACION+CHOQUES
                 * 12=VOLATILIDADES+CHOQUES
                 */
                int opcion=CMatriz.isSelected()?MATRIZ_CORRELACION:0;
                opcion+=CVolatilidades.isSelected()?VOLATILIDADES:0;
                opcion+=CChoques.isSelected()?CHOQUES:0;
                ///
                ///
                
                
                cScript=GenScripMatricesCir051.loadScript(xls.getAbsolutePath(),opcion);
                
                Hashtable<String, Object> h = GenVectorMatricesCir051.loadMatricez(xls.getAbsolutePath(),opcion);
                Double[][] volatilidades = (Double[][]) h.get("VOLATILIDADES");
                ((TModelUpdateCircular051) TVolatilidades.getModel()).setData(volatilidades==null?new Double[][]{}:volatilidades);
                TVolatilidades.setRowHeight(18);
                TVolatilidades.setRowHeight(0, 24);
                progreso.setValue(30);
                
                Double[][] matrizCorrelacion = (Double[][]) h.get("MATRIZ");
                ((TModelUpdateCircular051) TMatrizCorrelacion.getModel()).setData(matrizCorrelacion==null?new Double[][]{}:matrizCorrelacion);
                TMatrizCorrelacion.setRowHeight(0, 20);
                TMatrizCorrelacion.setRowHeight(3, 20);
                TMatrizCorrelacion.setRowHeight(6, 20);
                TMatrizCorrelacion.setRowHeight(9, 20);
                TMatrizCorrelacion.setRowHeight(12, 21);
                TMatrizCorrelacion.setRowHeight(15, 20);
                TMatrizCorrelacion.setRowHeight(16, 20);
                progreso.setValue(40);
                
                Double[][] matrizChoCOP = (Double[][]) h.get("MATRIZ_CHO_COP");
                ((TModelUpdateCircular051) TMatrizChoqueCOP.getModel()).setData(matrizChoCOP==null?new Double[][]{}:matrizChoCOP);
                progreso.setValue(50);
                
                Double[][] matrizChoUVR = (Double[][]) h.get("MATRIZ_CHO_UVR");
                ((TModelUpdateCircular051) TMatrizChoqueUVR.getModel()).setData(matrizChoUVR==null?new Double[][]{}:matrizChoUVR);
                progreso.setValue(60);    
                
                Double[][] matrizChoME = (Double[][]) h.get("MATRIZ_CHO_ME");
                ((TModelUpdateCircular051) TMatrizChoqueME.getModel()).setData(matrizChoME==null?new Double[][]{}:matrizChoME);
                progreso.setValue(80);
                
                jTabbedPane1.setSelectedIndex(1);
                c.add(1);
                BAlmacenar.setEnabled(true);
                progreso.setValue(100);
            } catch (java.lang.ArrayIndexOutOfBoundsException ex) {
                JOptionPane.showMessageDialog(getPanel(), "El numero de factores no concurda con el tamaño de la matriz: " + ex);
                BAlmacenar.setEnabled(false);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(getPanel(), "Error: " + ex);
                BAlmacenar.setEnabled(false);
            }
        }
    }
    public static int MATRIZ_CORRELACION=CodigoBotones.nuevo;
    public static int VOLATILIDADES=CodigoBotones.buscar;
    public static int CHOQUES=CodigoBotones.modificar;

}
